var express = require('express');
var router = express.Router();
var {indexSchema,cateSchema}=require('../model/model')
/* GET home page. */
router.get('/', function(req, res, next) {
  res.render('index', { title: 'Express' });
});

router.get('/list',async(req,res)=>{
  const data=await indexSchema.find()
  res.send({
    code:200,
    data

  })
})

router.get('/list1',async(req,res)=>{
  const data=await cateSchema.find()
  res.send({
    code:200,
    data
  })
})


module.exports = router;
